﻿<!DOCTYPE html>
<html lang="en">
<head>
    <title>登录</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!--<link href="__FINANCE__/Css/login.css" rel='stylesheet' type='text/css' />-->
    <script src="__FINANCE__/Scripts/jquery.js" charset="utf-8"></script>
    <script src="__FINANCE__/layui/layui.js" charset="utf-8"></script>
    <!--<script src="__FINANCE__/layui/css/layui.css" charset="utf-8"></script>-->

    <link rel="stylesheet" href="__FINANCE__/Css/login/css/bootstrap.css">
    <link rel="stylesheet" href="__FINANCE__/Css/login/login.css">
    <link rel="stylesheet" href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.css">
</head>
<body>
<!--<div class="main">-->
    <!--<div class="login">-->
        <!--<h1>新乡市纪委监委财务管理后台</h1>-->
        <!--<div class="inset">-->
            <!--&lt;!&ndash;start-main&ndash;&gt;-->
            <!--<form>-->

                <!--<div>-->
                    <!--&lt;!&ndash;<span><label>用户名</label></span>&ndash;&gt;-->
                    <!--<div class="login-icon"></div>-->
                    <!--<div style="float: right">-->
                        <!--<input type="text" class="textbox" id="username"  autocomplete="off">-->
                    <!--</div>-->
                <!--</div>-->
                <!--<div>-->
                    <!--&lt;!&ndash;<span><label>密码</label></span>&ndash;&gt;-->
                    <!--<span><input type="password" class="password" id="password"  autocomplete="off"></span>-->
                <!--</div>-->
                <!--<div class="sign">-->
                    <!--<input type="button" value="登录" class="submit login" />-->
                <!--</div>-->
            <!--</form>-->
        <!--</div>-->
    <!--</div>-->
    <!--&lt;!&ndash;//end-main&ndash;&gt;-->
<!--</div>-->

<h1 style="width: 1000px;margin: 5% auto 5% auto;"><img style="position: relative;top: -12px;right: 18px;" src="__FINANCE__/Images/dang_hui_log.png" height="60">新乡市纪委监委财务管理系统</h1>

<div>
    <div class="be-content pren">
        <!--<div class="ioc_text">-->
            <!--<img src="__FINANCE__/Images/login_login.jpg" alt="">-->
        <!--</div>-->
        <!--&gt;用户登录</>-->
        <div style="box-shadow: 10px 10px 5px #cac7c7;margin: 50px auto 0px">
            <form action="">
                <div class="br-content">
                    <div class="input-group mb-4 bootint">
                        <div class="input-group-prepend">
                            <span class="input-group-text" style="color:#f9f9f9;background-color: #0d7ae6;border: 1px solid #2989e8"><i class="fa fa-user"></i></span>
                        </div>
                        <input type="text" class="form-control" id="username" autocomplete="off" placeholder="用户名">
                    </div>

                    <div class="input-group mb-4 bootint">
                        <div class="input-group-prepend">
                            <span class="input-group-text" style="color:#f9f9f9;background-color: #0d7ae6;border: 1px solid #2989e8"><i class="fa fa-unlock-alt"></i></span>
                        </div>
                        <input type="password" class="form-control"  id="password"  autocomplete="off" placeholder="密码">
                    </div>

                    <div style="padding-top: 10px">
                        <input type="button"  class=" btn submit login" value="登&nbsp;&nbsp;&nbsp;录">
                    </div>
                    <div class="be-con">
                        <!--<span>Copyright © 2018 - 2019 <a href="">系统登陆</a></span>-->
                    </div>
                </div>
            </form>
        </div>

    </div>
</div>
<div style="text-align: center;padding: 60px">
    <p>版权所有&copy; 2022 新乡市纪律检查委员会</p>
</div>
<script>
    $(document).ready(function(){
        layui.use(['tree', 'util', 'form'], function () {
            function submitLogin(){
                var username = $('#username').val();
                var password = $('#password').val();
                if(username.length == 0 ) {
                    layer.msg('登录用户名不能为空'); return;
                }
                if(password.length == 0 ) {
                    layer.msg('登录密码错误'); return;
                }
                $.ajax({
                    url: '{:url("/finance/login/postLogin")}',
                    type: 'post',
                    dataType: 'json',
                    data: {username:username,password:password},
                    cache: false,
                    async: true,
                    beforeSend: function () {
                        var index = layer.load(1, {
                            shade: [0.1, '#fff'], time: 3 * 1000 //0.1透明度的白色背景
                        });
                    },
                    complete: function () {
                        layer.closeAll('loading');
                    },
                    success: function (res) {
                        console.log(res);
                        if (res.code) {
                            layer.msg('登录成功,请稍后...', {icon: 1});
                            window.location.href = '{:url("/finance/index/index")}';
                            return false;
                        } else {
                            layer.msg('用户名或者密码错误...', {icon: 5});
                            return  false;
                        }
                        return false;
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        layer.alert('网络失败，请联系管理员', {icon: 2});
                    }
                });
            }
            //点击登录
            $(document).on('click','.submit',function(){
                submitLogin()
            });
            //回车登录
            $(document).keydown(function(event){
                if(event.keyCode == 13){
                    submitLogin();
                }
            });
        });
    })
</script>
</body>
</html>
